package com.zilla.android.lib.ui.viewpager;

import android.content.Context;
import android.content.res.TypedArray;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.zilla.android.lib.ui.R;

/**
 * Created by zilla on 14-7-15.
 */
public class ViewpagerTitleLayout extends LinearLayout {

    private LayoutInflater mInflater;
    private Context mContext;

    public ViewpagerTitleLayout(Context context) {
        super(context);
    }

    public ViewpagerTitleLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context, attrs);
    }

    public ViewpagerTitleLayout(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init(context, attrs);
    }

    private void init(Context context, AttributeSet attrs) {
        this.mInflater = LayoutInflater.from(context);
        this.mContext = context;
        mInflater.inflate(R.layout.app_border, this, true);
        this.setOrientation(LinearLayout.VERTICAL);
//        borderHeader = findViewById(R.id.border_header);
//        iconImageView = (ImageView) findViewById(R.id.border_img);
//        riconImageView = (ImageView) findViewById(R.id.border_right);
//        titleTextView = (TextView) findViewById(R.id.broder_title);
//        xianView = findViewById(R.id.border_xian);
//
//        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.BorderLayout);
//        int headerbg = typedArray.getResourceId(R.styleable.BorderLayout_border_icon, R.drawable.transparent);
//        int iconRes = typedArray.getResourceId(R.styleable.BorderLayout_border_icon, R.drawable.transparent);
//        int riconRes = typedArray.getResourceId(R.styleable.BorderLayout_border_ricon, R.drawable.transparent);
//        String titleStr = typedArray.getString(R.styleable.BorderLayout_border_title);
//        boolean isxian = typedArray.getBoolean(R.styleable.BorderLayout_border_isxian, true);
//
//        if (headerbg != R.drawable.transparent) {
//            borderHeader.setBackgroundResource(headerbg);
//        }
//
//        if (iconRes != R.drawable.transparent) {
//            iconImageView.setImageResource(iconRes);
//        }
//
//        if (riconRes != R.drawable.transparent) {
//            riconImageView.setImageResource(riconRes);
//        }
//
//        if (!TextUtils.isEmpty(titleStr)) {
//            titleTextView.setText(titleStr);
//        }
//
//        if (!isxian) {
//            xianView.setVisibility(View.INVISIBLE);
//        }
//
////        this.setBackgroundResource(R.drawable.xml_border_bg);
//        int padding = getResources().getDimensionPixelSize(R.dimen.border_padding);
//        this.setPadding(padding, padding, padding, padding);
//
//        typedArray.recycle();
    }
}
